<template>
  <el-container>
    <el-header>
     <Header/>
    </el-header >
    <el-divider></el-divider>
    <div style="align-self: center">
      <el-input style="width:200px" placeholder="请输入影片名称" suffix-icon="el-icon-search"></el-input>
      <el-input style="width:200px" placeholder="请输入导演" suffix-icon="el-icon-search"></el-input>
      <el-input style="width:200px" placeholder="请输入类型" suffix-icon="el-icon-search"></el-input>
      <el-button @click="" class="ml-5" type="primary">搜索</el-button>
      <el-button type="warning" @click="">重置</el-button>
      <el-button type="warning" @click="dialoginsertVisible=true">插入</el-button>
    </div>
    <el-divider></el-divider>
    <el-table style="align-self: center"
              border
              :header-cell-style="headStyle"
              :data="tableData">
      <el-table-column prop="movieId" label="影片序号" width="50">
      </el-table-column>
      <el-table-column prop="pic" label="图片" width="100">
      </el-table-column>
      <el-table-column prop="movieName" label="影片名称" width="100">
      </el-table-column>
      <el-table-column prop="movieDescription" label="影片简介" width="500">
      </el-table-column>
      <el-table-column prop="lengthTime" label="放映时长" width="100">
      </el-table-column>
      <el-table-column prop="cost" label="标准票价">
      </el-table-column>
      <el-table-column prop="director" label="导演" width="50">
      </el-table-column>
      <el-table-column prop="mainAct" label="主演" width="400">
      </el-table-column>
      <el-table-column prop="remarks" label="操作" width="100">
        <el-button type="primary" @click="dialogeditVisible=true">修改</el-button>
        <el-button type="danger">删除</el-button>
      </el-table-column>
    </el-table>
    <div  style="padding:10px 0">
      <el-pagination
          :current-page="currentPage"
          :page-sizes="[5, 7, 10, 12]"
          :page-size="pagesize"
          layout="total, sizes, prev, pager, next, jumper"
          :total="tableData.length">
          style="margin-left: 300px">
      </el-pagination>
    </div>
    <el-dialog title="增加影片" :visible.sync="dialoginsertVisible">
      <el-form :model="movie">
        <el-form-item label="影片名称" :label-width="formLabelWidth">
          <el-input v-model="movie.name" autocomplete="off" @input="changNo"></el-input>
        </el-form-item>
        <el-form-item label="图片" :label-width="formLabelWidth">
          <el-input v-model="movie.img" autocomplete="off" @input="changNo"></el-input>
        </el-form-item>
        <el-form-item label="影片简介" :label-width="formLabelWidth">
          <el-input v-model="movie.simp" autocomplete="off" @input="changNo"></el-input>
        </el-form-item>
        <el-form-item label="放映时长" :label-width="formLabelWidth">
          <el-input v-model="movie.timeline" autocomplete="off" @input="changNo"></el-input>
        </el-form-item>
        <el-form-item label="标准票价" :label-width="formLabelWidth">
          <el-input v-model="movie.ticket" autocomplete="off" @input="changNo"></el-input>
        </el-form-item>
        <el-form-item label="导演" :label-width="formLabelWidth">
          <el-input v-model="movie.director" autocomplete="off" @input="changNo"></el-input>
        </el-form-item>
        <el-form-item label="主演" :label-width="formLabelWidth" prop="appCategory2">
          <el-input v-model="movie.mainactor" autocomplete="off" @input="changNo"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialoginsertVisible = false">取消</el-button>
        <el-button type="primary" @click="dialoginsertVisible = false ;">确认</el-button>
      </div>
    </el-dialog>
    <el-dialog title="修改影片" :visible.sync="dialogeditVisible">
      <el-form :model="moviee">
        <el-form-item label="影片名称" :label-width="formLabelWidth">
          <el-input v-model="moviee.name" autocomplete="off" @input="changNo"></el-input>
        </el-form-item>
        <el-form-item label="图片" :label-width="formLabelWidth">
          <el-input v-model="moviee.img" autocomplete="off" @input="changNo"></el-input>
        </el-form-item>
        <el-form-item label="影片简介" :label-width="formLabelWidth">
          <el-input v-model="moviee.simp" autocomplete="off" @input="changNo"></el-input>
        </el-form-item>
        <el-form-item label="放映时长" :label-width="formLabelWidth">
          <el-input v-model="moviee.timeline" autocomplete="off" @input="changNo"></el-input>
        </el-form-item>
        <el-form-item label="标准票价" :label-width="formLabelWidth">
          <el-input v-model="moviee.ticket" autocomplete="off" @input="changNo"></el-input>
        </el-form-item>
        <el-form-item label="导演" :label-width="formLabelWidth">
          <el-input v-model="moviee.director" autocomplete="off" @input="changNo"></el-input>
        </el-form-item>
        <el-form-item label="主演" :label-width="formLabelWidth" prop="appCategory2">
          <el-input v-model="moviee.mainactor" autocomplete="off" @input="changNo"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogeditVisible = false">取消</el-button>
        <el-button type="primary" @click="dialogeditVisible = false ;">确认</el-button>
      </div>
    </el-dialog>
  </el-container>
</template>

<script>
import Header from "@/components/Header";
export default {
  name: "moviemanage",
  components: {Header},
  data(){
    return{
      tableData:[],
      currentPage:1,
      pagesize:5,
      dialoginsertVisible :false,
      dialogeditVisible:false,
      movie:{
      name:'',
      img:'',
      simp:'',
      timeline:'',
      ticket:'',
      director:'',
      mainactor:'',
      },
      moviee:{
        name:'',
        img:'',
        simp:'',
        timeline:'',
        ticket:'',
        director:'',
        mainactor:'',
      }
    }
  },
  methods:{
    changNo(){
      this.$forceUpdate(0)
    },
    headStyle(){
      return "text-align:center"
    }
  }
}
</script>

<style scoped>

</style>